import { Model } from '@wattjs/network'
import { PREFIX } from './config'
import Http from './index'

export const userLogin = Model(Http, {
  prefix: PREFIX,
  url: '/login',
  method: 'POST',
})

export const userRegistry = Model(Http, {
  prefix: PREFIX,
  url: '/register',
  method: 'POST',
})

export const sendSmsCode = Model(Http, {
  prefix: PREFIX,
  url: '/common/sendSmsCode',
  method: 'POST',
})

export const getUserInfo = Model(Http, {
  prefix: PREFIX,
  url: '/user/getUserInfo',
})

export const loginBySmsCode = Model(Http, {
  prefix: PREFIX,
  url: '/loginBySms',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded'
  },
  method: 'POST',
})

export const logout = Model(Http, {
  prefix: PREFIX,
  url: '/logout',
})
